﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
namespace Quality.spc
{
    public partial class ColumnImage : Form
    { DataTable dt;
        public ColumnImage()
        {
            InitializeComponent();
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
             getdata frm = new getdata();

            frm.WindowState = FormWindowState.Normal;
            frm.Dock = DockStyle.Fill;
            frm.TransfEventdt += frm_TransfEventdt;
            frm.StartPosition = FormStartPosition.CenterParent;

            frm.Show();
        }
        //事件处理方法
        void frm_TransfEventdt(DataTable value)
        {
            dataGridView1.DataSource = value;
            this.dt = value;
        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            chart1.Series.Clear();
            
            chart1.Series.Add("测量值");//添加 
             chart1.Series[0].ChartType = SeriesChartType.Column;
           

              for (int i = 0; i < dt.Rows.Count; i++) {
               
                chart1.Series[0].Points.AddXY(dt.Rows[i][0].ToString(), dt.Rows[i][1]);
            }

        }

        

     }
    
}
